package jrpc

import (
	"context"
	"encoding/json"
	"fmt"

	"github.com/osamingo/jsonrpc/v2"
	"github.com/zeromicro/go-zero/core/logc"
)

func RegisterMethod() {
	Register(&{{.upperStartCamelObject}}DeleteFunc{})
}

type {{.upperStartCamelObject}}DeleteParams struct {
	{{.upperStartCamelPrimaryKey}} {{.dataType}}
}

type {{.upperStartCamelObject}}DeleteResult struct {
}

type {{.upperStartCamelObject}}DeleteFunc struct {
	{{.upperStartCamelObject}}DeleteParams
	{{.upperStartCamelObject}}DeleteResult
}

func (t *{{.upperStartCamelObject}}Func) Name() string {
	return fmt.Sprintf("%s.%s", {{.table}}, "Delete")
}

func (t *{{.upperStartCamelObject}}DeleteFunc) ServeJSONRPC(c context.Context, params *json.RawMessage) (result any, err *jsonrpc.Error) {
	logc.Infof(c, "%s( %v )", t.Name(), *params)
	return nil, nil
}

func (t *{{.upperStartCamelObject}}DeleteFunc) Params() any {
	return t.{{.upperStartCamelObject}}DeleteParams
}

func (t *{{.upperStartCamelObject}}DeleteFunc) Result() any {
	return t.{{.upperStartCamelObject}}DeleteResult
}
